<template>
  <div>
    <a-layout id="components-layout-demo-side" style="min-height: 100vh">
      <a-layout-sider v-model:collapsed="collapsed" collapsible :style="{background: '#fff'}">
        <div class="logo"/>
        <a-menu theme="light" v-model:selectedKeys="selectedKeys" mode="inline">
          <a-menu-item key="1" @click="ToHome">
            <pie-chart-outlined/>
            <span>概况</span>
          </a-menu-item>
          <a-menu-item key="2" @click="ToMoniter">
            <desktop-outlined/>
            <span>监视</span>
          </a-menu-item>
          <a-sub-menu key="sub1">
            <template #title>
              <span><user-outlined/><span>User</span></span>
            </template>
            <a-menu-item key="3">Tom</a-menu-item>
            <a-menu-item key="4">Bill</a-menu-item>
            <a-menu-item key="5">Alex</a-menu-item>
          </a-sub-menu>
          <a-sub-menu key="sub2">
            <template #title>
              <span><team-outlined/><span>Team</span></span>
            </template>
            <a-menu-item key="6">Team 1</a-menu-item>
            <a-menu-item key="8">Team 2</a-menu-item>
          </a-sub-menu>
          <a-menu-item key="9">
            <file-outlined/>
            <span>File</span>
          </a-menu-item>
        </a-menu>
      </a-layout-sider>
      <a-layout>
        <a-layout-header style="background: #fff; padding: 0"/>
        <a-layout-content style="margin: 0 16px">
          <a-breadcrumb style="margin: 16px 0">
            <a-breadcrumb-item href="" v-for="(item,i) in $route.path.toString().split('/')" :key="item">
              {{
                routes.forEach((e) => {
                  return e.path
                })
              }}
              {{ (routes[i].breadcrumbName) }}
            </a-breadcrumb-item>

          </a-breadcrumb>
          <router-view>

          </router-view>

        </a-layout-content>
        <a-layout-footer style="text-align: center">
          疫 情 医 院 管 理 系 统

        </a-layout-footer>
      </a-layout>
    </a-layout>
  </div>
</template>

<script>

//import {LineChart} from '@opd/g2plot-vue'

import {
  PieChartOutlined,
  DesktopOutlined,
  UserOutlined,
  TeamOutlined,
  FileOutlined,
} from '@ant-design/icons-vue';
import {ref} from 'vue';
// const fakeDataUrl = 'https://randomuser.me/api/?results=5&inc=name,gender,email,nat&noinfo';
// import reqwest from 'reqwest';

export default {
  name: "Dashboard",
  components: {
    // LineChart,

    PieChartOutlined,
    DesktopOutlined,
    UserOutlined,
    TeamOutlined,
    FileOutlined,
  },
  setup() {
    const routes = ref([
      {
        path: 'dashborad',
        breadcrumbName: '首页',
      },
      {
        path: 'survey',
        breadcrumbName: '概况',
      },
      {
        path: 'mintor',
        breadcrumbName: '监控',
      },


    ]);
    return {
      basePath: '',
      routes,
    };

  },
  data() {
    return {
      collapsed: false,
      selectedKeys: ['1'],


    }
  }, mounted() {

  }, methods: {
    ToHome() {
      this.$router.replace({name: 'survey'}).catch(err => {
        err
      })
    },
    ToMoniter() {
      this.$router.replace({name: 'monitor'}).catch(err => {
        err
      })
    },
  }


}
</script>

<style scoped>
#components-layout-demo-side .logo {
  height: 32px;
  background: rgba(0, 0, 0, 0.2);
  margin: 16px;
}

.demo-loadmore-list {
  min-height: 350px;
}
</style>